package com.bbu.javaexam.test;

/**
 * 存钱线程
 */
public class AddMoneyThread implements Runnable {

    // 存入账户
    // 方法一
    private Account account;
    // 方法二
//    private Account02 account;

    // 存入金额
    private double money;

    public AddMoneyThread(Account account, double money) {
        this.account = account;
        this.money = money;
    }

    @Override
    public void run() {
        synchronized (account) {
            account.deposit(money);
        }
    }
}
